﻿using NHibernate.Mapping.ByCode;
using System;
namespace Citi.HeadCount.Domain.Mapping
{
    public class GOCMap : EntityMapping<GOC>
    {
        public GOCMap()
        {
            Property(x => x.GOCAttribute, m => { m.NotNullable(true); m.Length(20); });
            Property(x => x.LongDescription, m => { m.NotNullable(true); m.Length(250); });
            Property(x => x.Status, m => { m.NotNullable(true); m.Length(1); });
            Property(x => x.UpdatedDate, m => { m.NotNullable(true); });
            Property(x => x.SidId, m => { m.NotNullable(true); });
            Property(x => x.LocalCostCode, m => { m.NotNullable(true); m.Length(10); });
            Property(x => x.Manager, m => { m.NotNullable(true); m.Length(7); });
            Property(x => x.FRSBuId, m => { m.NotNullable(true); });
            Property(x => x.FRSOuId, m => { m.NotNullable(true); });
            Property(x => x.FunctionId, m => { m.NotNullable(true);});
            Property(x => x.LevelId, m => { m.NotNullable(true); });
            Property(x => x.CountryId, m => { m.NotNullable(true); });
            Property(x => x.ExpenseCode, m => { m.NotNullable(false); });
            Property(x => x.CorpCode, m => { m.NotNullable(false); });
            Property(x => x.RuleResultId, m => { m.NotNullable(false);});
            Property(x => x.ManagedSegmentId, m => { m.NotNullable(true); });

            ManyToOne(x => x.Country, m =>
            {
                m.Column("CountryId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.Sid, m =>
            {
                m.Column("SidId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.FRSBu, m =>
            {
                m.Column("FRSBuId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.FRSOu, m =>
            {
                m.Column("FRSOuId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.Function, m =>
            {
                m.Column("FunctionId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.Level, m =>
            {
                m.Column("LevelId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });

            ManyToOne(x => x.RuleResult, m =>
            {
                m.Column("RuleResultId");
                m.NotNullable(false);
                m.Insert(false);
                m.Update(false);
                //m.Lazy(LazyRelation.NoProxy);
            });

            ManyToOne(x => x.ManagedSegment, m =>
            {
                m.Column("ManagedSegmentId");
                m.NotNullable(true);
                m.Insert(false);
                m.Update(false);
            });
        }
    }
}
